<template>
  <div>
    <div class="introduceBox">
      <div class="imgBox">
        <img :src="detailObj.coverUrl" alt="" />
      </div>
      <div class="introduceBoxRight">
        <div class="introduceBoxTitle">
          <p class="label"></p>
          <div class="songSheetName" :title="detailObj.name">
            {{ detailObj.name }}
          </div>
        </div>
        <div class="userBox">
          <span class="audioIcon"></span>
          <span class="brand">{{ detailObj.dj && detailObj.dj.brand }}</span>
          <div class="btnClass subscribeBtn">
            <i><em />订阅({{ detailObj.radio && detailObj.radio.subCount }})</i>
          </div>
        </div>
      </div>
    </div>
    <div class="btnBox">
      <div class="btnClass playBtn">
        <i>播放 {{ detailObj.duration | MillisecondToDate }}</i>
      </div>
      <div class="btnClass fabulous">
        <i><em />({{ detailObj.likedCount | numChange }})</i>
      </div>
      <div class="btnClass comment">
        <i>({{ detailObj.commentCount | numChange }})</i>
      </div>
      <div class="btnClass forward">
        <i>({{ detailObj.shareCount | numChange }})</i>
      </div>
    </div>
    <div class="sub">
      <span class="audioType">{{
        detailObj.radio && detailObj.radio.category
      }}</span>
      <span class="serialNum"
        >{{ detailObj.dj.brand }} 第{{ detailObj.serialNum }}期</span
      >
      <span class="createTime"
        >{{ detailObj.createTime | fmtDate("yyyy-MM-DD") }}创建</span
      >
      <span class="listenerCount"
        >播放：<i>{{ detailObj.listenerCount }}</i> 次</span
      >
    </div>
    <p class="description">介绍：{{ detailObj.description }}</p>
  </div>
</template>

<script>
import { mapActions } from "vuex";
export default {
  props: {
    detailObj: {
      type: Object,
      default: {},
    },
  },
  filters: {
    numChange(num) {
      if (num > 99999) {
        return parseInt(num / 10000) + "万";
      } else {
        return num;
      }
    },
    MillisecondToDate(msd) {
      var time = parseFloat(msd) / 1000;
      if (null != time && "" != time) {
        if (time > 60 && time < 60 * 60) {
          time =
            parseInt(time / 60.0) +
            "分钟" +
            parseInt((parseFloat(time / 60.0) - parseInt(time / 60.0)) * 60) +
            "秒";
        } else if (time >= 60 * 60 && time < 60 * 60 * 24) {
          time =
            parseInt(time / 3600.0) +
            "小时" +
            parseInt(
              (parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60
            ) +
            "分钟" +
            parseInt(
              (parseFloat(
                (parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60
              ) -
                parseInt(
                  (parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60
                )) *
                60
            ) +
            "秒";
        } else {
          time = parseInt(time) + "秒";
        }
      }
      return time;
    },
  },
  methods: {
    ...mapActions("musicStore", ["songSheetPlay", "addMusicList"]),
  },
};
</script>

<style lang="scss" scoped>
.introduceBox {
  width: 100%;
  display: flex;
  .imgBox {
    width: 140px;
    height: 140px;
    padding: 2px;
    border: 1px solid #ccc;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .introduceBoxRight {
    flex: 1;
    overflow: hidden;
    margin-left: 30px;
    .introduceBoxTitle {
      padding-top: 18px;
      margin-bottom: 29px;
      display: flex;
      .label {
        width: 73px;
        height: 24px;
        background: url("./../../assets/imges/iconOne.png") no-repeat 0 -75px;
        margin-right: 10px;
      }
      .songSheetName {
        flex: 1;
        line-height: 24px;
        font-size: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
    .userBox {
      display: flex;
      align-items: center;
      margin: 12px 0 20px;
      .audioIcon {
        width: 16px;
        height: 17px;
        background-position: -50px -20px;
        background: url("./../../assets/imges/iconOne.png") no-repeat -50px -20px;
        display: inline-block;
      }
      .brand {
        color: #666;
        font-size: 16px;
        margin: 0 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
}
.btnBox {
  margin-top: 20px;
  .forward {
    i {
      background: url("./../../assets/imges/backgroundStripe.png") no-repeat 0 -1225px;
    }
  }
  .fabulous {
    background-position: right -100px;
    color: #333;
    i {
      padding: 0 5px 0 10px;
      background-position: 0 -59px;
      em {
        vertical-align: middle;
        margin-right: 5px;
        width: 17px;
        height: 15px;
        display: inline-block;
        background: url("./../../assets/imges/backgroundStripe.png") no-repeat 0 -95px;
      }
    }
  }
  .comment {
    background-position: right -1020px;
    color: #333;
    i {
      padding: 0 7px 0 36px;
      background-position: 0 -1465px;
    }
  }
  .playBtn {
    background-position: right -676px;
    color: #fff;
    i {
      padding: 0 7px 0 36px;
      background-position: 0 -633px;
    }
  }
}
.btnClass {
  color: #333;
  background: url("./../../assets/imges/backgroundStripe.png") no-repeat right -1020px;
  padding: 0 5px 0 0;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
  i {
    padding-right: 2px;
    padding-left: 28px;
    height: 31px;
    line-height: 30px;
    display: inline-block;
    min-width: 23px;
    background: url("./../../assets/imges/backgroundStripe.png") no-repeat 0 -977px;
    cursor: pointer;
  }
}
.subscribeBtn {
  background-position: right -2400px;
  color: #333;
  i {
    padding-left: 8px;
    line-height: 28px;
    height: 28px;
    background: url("./../../assets/imges/backgroundStripe.png") no-repeat 0 -2370px;
    em {
      vertical-align: middle;
      margin-right: 5px;
      width: 14px;
      height: 14px;
      display: inline-block;
      background: url("./../../assets/imges/iconOne.png") no-repeat -50px 0;
    }
  }
}
.sub {
  margin-top: 25px;
  height: 35px;
  line-height: 35px;
  .audioType {
    color: #cc0000;
    overflow: hidden;
    padding: 0 6px;
    border: 1px solid #999;
    border-color: #cc0000;
    margin: -3px 9px 0 0;
    height: 16px;
  }
  .serialNum {
    font-size: 14px;
    color: #333;
    font-weight: bold;
  }
  .createTime {
    color: #999;
    margin-left: 18px;
  }
  .listenerCount {
    color: #999;
    margin-left: 18px;
    i {
      color: #c20c0c;
    }
  }
}
.description {
  color: #666;
  line-height: 23px;
  margin-bottom: 30px;
}
</style>